package com.example.qihuibao.module.main

import androidx.lifecycle.LiveData
import androidx.lifecycle.ViewModel
import com.example.qihuibao.bean.*

/**
 *@author: cww
 *@desc:
 *@date: 4/22/23 11:15 AM
 */
class MainViewModel : ViewModel() {
    private val repository = MainRepository()

    //    企业信息查询	corp_qry
    fun queryEnterpriseInfo() : LiveData<RspQueryEnterpriseInfoBean> {
        return repository.queryEnterpriseInfo(BaseReqBean("corp_qry", "1.0"))
    }

    //    企业信息更新	corp_update
    fun updateEnterpriseInfo(req : ReqUpdateEnterpriseInfoBean) : LiveData<BaseRspBean> {
        return repository.updateEnterpriseInfo(req)
    }

    //    部门信息查询	dep_qry
    fun queryDepartmentInfo() : LiveData<RspQueryDepartmentInfoBean> {
        return repository.queryDepartmentInfo(BaseReqBean("dep_qry", "1.0"))
    }

    //    部门信息更新	dep_update
    fun updateDepartmentInfo(req : ReqUpdateDepartmentInfoBean) : LiveData<BaseRspBean> {
        return repository.updateDepartmentInfo(req)
    }

    //    部门信息新增	dep_add
    fun addDepartmentInfo(req : ReqAddDepartmentInfoBean) : LiveData<BaseRspBean> {
        return repository.addDepartmentInfo(req)
    }

    //    部门信息删除	dep_delete
    fun deleteDepartmentInfo(req : ReqDeleteDepartmentInfoBean) : LiveData<BaseRspBean> {
        return repository.deleteDepartmentInfo(req)
    }

    //    人员信息查询	emp_qry
    fun queryEmployInfo(req:ReqQueryEmployInfoBean) : LiveData<RspQueryEmployInfoBean> {
        return repository.queryEmployInfo(req)
    }

    //    人员信息更新	emp_update
    fun updateEmployInfo(req : ReqUpdateEmployInfoBean) : LiveData<BaseRspBean> {
        return repository.updateEmployInfo(req)
    }

    //    人员信息新增	emp_add
    fun addEmployInfo(req : ReqAddEmployInfoBean) : LiveData<BaseRspBean> {
        return repository.addEmployInfo(req)
    }

    //    人员信息删除	emp_delete
    fun deleteEmployInfo(req : ReqDeleteEmployInfoBean) : LiveData<BaseRspBean> {
        return repository.deleteEmployInfo(req)
    }

    //    餐厅信息查询	cant_qry
    fun queryCanteenInfo(req:ReqQueryCanteenInfoBean) : LiveData<RspQueryCanteenInfoBean> {
        return repository.queryCanteenInfo(req)
    }

    //    餐厅信息更新	cant_update
    fun updateCanteenInfo(req : ReqUpdateCanteenInfoBean) : LiveData<BaseRspBean> {
        return repository.updateCanteenInfo(req)
    }

    //    餐别信息查询	meal_qry
    fun queryMealInfo(req:ReqQueryMealInfoBean) : LiveData<RspQueryMealInfoBean> {
        return repository.queryMealInfo(req)
    }

    //    餐别信息更新	meal_update
    fun updateMealInfo(req : ReqUpdateMealInfoBean) : LiveData<BaseRspBean> {
        return repository.updateMealInfo(req)
    }

    //    收费标准查询	fee_qry
    fun queryFees(req:ReqQueryFeesBean) : LiveData<RspQueryFeesBean> {
        return repository.queryFees(req)
    }

    //    收费标准更新	fee_update
    fun updateFees(req:ReqUpdateFeesBean) : LiveData<BaseRspBean> {
        return repository.updateFees(req)
    }

    //    收费标准新增	fee_add  (新增后FeeID会随机分配)
    fun addFees(req:ReqAddFeesBean) : LiveData<RspAddFeesBean> {
        return repository.addFees(req)
    }

    //    收费标准删除	fee_delete
    fun deleteFees(req:ReqDeleteFeesBean) : LiveData<BaseRspBean> {
        return repository.deleteFees(req)
    }

    //    心跳通知	heartbeat
    fun heartbeat() : LiveData<RspHeartbeatBean> {
        return repository.heartbeat(ReqHeartbeatBean())
    }

    //    人脸文件查询	face_file_qry
    fun queryFaceFile(req:ReqQueryFaceFileBean) : LiveData<RspQueryFaceFileBean> {
        return repository.queryFaceFile(req)
    }

    //    人脸文件下载	face_file_download
    fun downloadFaceFile(faceFile:RspQueryFaceFileBean.FaceFile) : LiveData<BaseRspBean> {
        return repository.downloadFaceFile(faceFile)//todo 返回的是文件
    }

    //    订餐明细查询	order_qry
    fun queryOrderInfo(req:ReqQueryOrderInfoBean) : LiveData<RspQueryOrderInfoBean> {
        return repository.queryOrderInfo(req)
    }

    //    取餐/消费	use_consume
    fun useConsume(req:ReqUseConsumeBean) : LiveData<RspUseConsumeBean> {
        return repository.useConsume(req)
    }

    //    支付明细查询	pay_qry
    fun queryPayDetail(req:ReqQueryPayDetailBean) : LiveData<RspQueryPayDetailBean> {
        return repository.queryPayDetail(req)
    }

    //    取餐明细查询	use_qry
    fun queryUseDetail(req:ReqUseDetailBean) : LiveData<RspUseDetailBean> {
        return repository.queryUseDetail(req)
    }

    //    余额通知	balance_notice  (对账标准为外部系统，将余额信息同步到企慧宝系统)
    fun balanceNotice(req:ReqBalanceNotifyBean) : LiveData<RspBalanceNotifyBean> {
        return repository.balanceNotice(req)
    }

    //    电子餐票取餐/消费	et_use_consume
    fun etTicketUseConsume(req:ReqETTicketUseConsumeBean) : LiveData<RspETTicketUseConsumeBean> {
        return repository.etTicketUseConsume(req)
    }

    //    冲正	reverse  (对取餐、消费交易进行反交易，仅支持当天交易冲正。仅支持按照流水号对原交易实现整笔冲正，不支持部分冲正和调整。冲正形成一笔和原交易相同但方向相反的流水，不删除原交易。该交易为消费终端交易。)
    fun reverse(req:ReqReverseBean) : LiveData<RspReverseBean> {
        return repository.reverse(req)
    }
}